<template>
  <div class="home">
    <div :class="a">
      <div class="left-icon">
        <i @click="menu" class="el-icon-s-unfold"></i>
      </div>
      <div class="left-ui-div">
        <ul class="left-ui">
          <li @click="toPath(1)"><i class="el-icon-discount"></i>酒店</li>
          <li @click="toPath(2)"><i class="el-icon-wind-power"></i>旅游</li>
          <li @click="toPath(3)"><i class="el-icon-coin"></i>订单</li>
          <li @click="toPath(4)"><i class="el-icon-s-unfold"></i>评论</li>
          <li><i class="el-icon-s-unfold"></i>评论</li>
          <li><i class="el-icon-s-unfold"></i>评论</li>
        </ul>
      </div>
    </div>
    <div class="top">
      <div class="top-1">
        <div class="pic">logo</div>
        <div class="input">
          <el-input
            v-model="keyword"
            size="mini"
            placeholder="请输入搜索内容"
          ></el-input>
        </div>
        <div class="button">
          <el-button size="mini" type="primary">搜索</el-button>
        </div>
        <div @click="login" class="username">请登录</div>
        <div class="register">注册</div>
      </div>
    </div>
    <div class="contents">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  name: "HomeView",
  data() {
    return {
      a: "menu-left",
      path: 1,
      keyword: "",
    };
  },
  methods: {
    menu() {
      console.log("123");
      if (this.$data.a == "menu-left1") {
        this.$data.a = "menu-left";
      } else {
        this.$data.a = "menu-left1";
      }
    },
    login() {
      console.log("789")
      this.$router.push("/login");
    },
    toPath(id) {
      if ((id == 1) & (this.$data.path != id)) {
        this.$router.push("hotel");
      }
      if ((id == 2) & (this.$data.path != id)) {
        this.$router.push("trip");
      }
      if ((id == 3) & (this.$data.path != id)) {
        this.$router.push("order");
      }
      if ((id == 4) & (this.$data.path != id)) {
        this.$router.push("comment");
      }
      this.$data.path = id;
    },
  },
};
</script>

<style lang="less" scoped>
.menu-left {
  position: relative;
  z-index: 10;
  background-color: white;
  height: 100vh;
  width: 130px;
  overflow: hidden;
  padding: 25px 10px;
  box-sizing: border-box;
  border-right: 2px rgb(185, 177, 177) solid;
  .left-icon {
    margin-left: 7px;
    font-size: 20px;
    color: rgb(97, 94, 94);
  }
  .left-ui-div {
    .left-ui {
      list-style: none;
      padding: 0;
      li {
        padding: 5px 0px;
        font-size: 14px;
        width: 108px;
        margin: 10px 0;
        i {
          margin-right: 13px;
          margin-left: 10px;
          color: rgb(0, 134, 246);
        }
      }
      li:hover {
        background-color: rgb(0, 134, 246);
        border-radius: 20px;
        color: white;
        i {
          color: white;
        }
      }
    }
  }
}
.menu-left1 {
  position: relative;
  z-index: 10;
  background-color: white;
  height: 100vh;
  width: 50px;
  overflow: hidden;
  padding: 25px 10px;
  box-sizing: border-box;
  border-right: 2px rgb(185, 177, 177) solid;
  .left-icon {
    margin-left: 7px;
    font-size: 20px;
    color: rgb(97, 94, 94);
  }
  .left-ui-div {
    .left-ui {
      list-style: none;
      padding: 0;
      li {
        padding: 5px 0px;
        font-size: 14px;
        width: 108px;
        margin: 10px 0;
        i {
          margin-right: 13px;
          margin-left: 10px;
          color: rgb(0, 134, 246);
        }

        i:hover {
          color: red;
        }
      }
    }
  }
}

.top {
  position: absolute;
  top: 0;
  left: 0;
  height: 60px;
  width: 100vw;
  // background-color: red;
  border: 1px solid rgb(223, 205, 205);
  .top-1 {
    position: absolute;
    height: 60px;
    width: 950px;
    left: 50%;
    transform: translateX(-43%);
    display: flex;
    .pic {
      height: 60px;
      width: 150px;
      background-color: red;
    }
    .input {
      margin: 15px 0px;
      margin-left: 40px;
    }
    .button {
      margin: 15px 0px;
    }
    .username {
      font-size: 10px;
      margin: 20px 0px 20px 150px;
    }
    .register {
      font-size: 10px;
      margin: 20px 0px 20px 150px;
    }
  }
}
.contents {
  width: 1100px;
  height: 690px;
  position: absolute;
  top: 63px;
  left: 20%;
  transform: translateX(-10%);
}
</style>
